<?php
	session_start();
	require "../core/config.php";
	require "../core/function.php";

	if ($_SERVER['REQUEST_METHOD'] == "POST") {
		$login = (string)$_POST['login'];
		$pass = (string)$_POST['pass'];

		if (is_admin($login, $pass)) {
			$_SESSION['admin'] = array($login, $pass);
			header("Location: index.php");
		} else {
			echo "<h1 class='warning'>Не правильный пароль !</h1>";
		}
	}
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Вход в админку</title>
	<link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="../css/admin.css" rel="stylesheet">
</head>
<body>
	<form action="auth.php" method="post" id="auth">
		<div class="form-group">
			<input type="text" name="login" placeholder="Login..." class="form-control">
			<span class="glyphicon glyphicon-user"></span>
		</div>
		<div  class="form-group">
			<input type="password" name="pass" placeholder="Password..." class="form-control">
			<span class="glyphicon glyphicon-lock"></span>
		</div>
		<div  class="form-group">
			<input type="submit" name="enter" class="btn btn-primary" value="Войти">
			<a href="../" class="btn btn-primary">На сайт</a>
		</div>
	</form>
</body>
</html>